package com.woniu.service.impl;

import com.woniu.outlet.dao.PurchaseDetailPoMapper;
import com.woniu.outlet.dao.PurchasePoMapper;
import com.woniu.outlet.po.PurchaseDetailPo;
import com.woniu.outlet.po.PurchaseDetailPoExample;
import com.woniu.service.PurchaseDetailPoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("detailPoService")
public class PurchaseDetailPoServiceImp implements PurchaseDetailPoService {

    @Autowired
    private PurchaseDetailPoMapper purchaseDetailPoMapper;

    //采购详情
    public List<PurchaseDetailPo> findAll(Long id) {
        PurchaseDetailPoExample poExample = new PurchaseDetailPoExample();
        PurchaseDetailPoExample.Criteria criteria = poExample.createCriteria();
        criteria.andPurchaseIdEqualTo(id);
        List<PurchaseDetailPo> poList = purchaseDetailPoMapper.selectByExample(poExample);
        return poList;
    }

    //根据物料编码查询单个采购详情
    public List<PurchaseDetailPo> getPurByCode(String code){

        PurchaseDetailPoExample poExample = new PurchaseDetailPoExample();
        PurchaseDetailPoExample.Criteria criteria = poExample.createCriteria();
        criteria.andMaterialCodeEqualTo(code);
        List<PurchaseDetailPo> poList = purchaseDetailPoMapper.selectByExample(poExample);
        return poList;
    }

}
